﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace Irandeb4.Models
{
    public class Company
    {
        public int CompanyId { get; set; }
        public int CityId { get; set; }
        public int EmployeeId { get; set; }
        public List<Product> Products { get; set; }

        [Required(ErrorMessage = "por favor introduzca un NIT")]
        [StringLength(13, MinimumLength= 10,ErrorMessage= "el NIT debe tener minimo 10 digitos y maximo 13")]
        //[IsNumber(ErrorMessage="el NIT solo permite numeros")]
        [RegularExpression(@"^[0-9]{0,100}", ErrorMessage = "El NIT solo permite numeros")]
        public string Nit { get; set; }

        [Required(ErrorMessage = "por favor introduzca un nombre")]
        [StringLength(20, MinimumLength = 3, ErrorMessage = "el nombre debe ser de minimo 3 cararteres y maximo 20")]
        public string Name { get; set; }

        [Required(ErrorMessage = "por favor introduzca un email")]
        [StringLength(30, MinimumLength = 5, ErrorMessage = "el email debe ser de minimo 5 cararteres y maximo 30")]
        [RegularExpression(".+\\@.+\\..+", ErrorMessage = "por favor introduzca un email valido")]
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }

        [StringLength(15, MinimumLength = 7, ErrorMessage = "el telefono debe ser de minimo 7 cararteres y maximo 15")]
        public string Phone { get; set; }

        [StringLength(15, MinimumLength = 7, ErrorMessage = "el fax debe ser de minimo 7 cararteres y maximo 15")]
        public string Fax { get; set; }

        [StringLength(80, MinimumLength = 5, ErrorMessage = "la direccion debe ser de minimo 5 cararteres y maximo 80")]
        public string Address { get; set; }

        public bool Active { get; set; }

        [ScaffoldColumn(false)]
        public bool Coustomer { get; set; }

        public virtual City City { get; set; }

        [ScaffoldColumn(false)]
        public virtual Employee Employee { get; set; }
    }
}
